package com.altio.swing;


import java.awt.Component;

/**
 * Simple interface to describe a wrapper round a swing component that can be
 * selected via the Selection Manager. Components can be highlighted as well as
 * selected. A typical highlight action would be caused by a mouse over whereas
 * a
 * 
 * @author tomm
 * @altioapi all
 * 
 */
public interface SelectableComponent {
  /**
   * Notifies this component that it has been selected/deselected
   * 
   * @param selected
   *          true if the component should appear to be selected
   */
  public void setSelected(boolean selected);

  /**
   * Notifies this component that it has been highlighted/dehighlighted
   * 
   * @param highlighted
   *          true if the component should appear to be
   *          highlighted/dehighlighted
   */
  public void setHighlighted(boolean highlighted);

  /**
   * @return true if the component is currently selected
   */
  public boolean isSelected();

  /**
   * @return true if the component is currently highlighted
   */
  public boolean isHighlighted();

  /**
   * Gets the Swing Component that the implementation wraps.
   * 
   * @return Component
   */
  public Component getComponent();

  /**
   * Adds a listener that should be notified when the user performs a UI action
   * that would cause a selection/deselection or cause the component to become
   * or cease to be highlighted.
   * 
   * @param listener
   */
  public void addSelectionActionListener(SelectionActionListener listener);
  
  /**
   * Opposite of addSelectedActionListener
   * 
   * PR 2147
   * 
   * @param listener
   */
  public void removeSelectionActionListener(SelectionActionListener listener);
}
